package com.noassertions.web;

import java.util.ArrayList;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.noassertions.data.DAOInterface;

@Controller
public class RiderController
{
    protected final Log log = LogFactory.getLog(getClass());
    private final DAOInterface dao;

    @Autowired
    public RiderController(DAOInterface dao) {
        this.dao = dao;
    }    
    
	@RequestMapping("/rider/{riderid}")
	public String getRider(@PathVariable Integer riderid, Model model)
	{
		ArrayList riders = dao.getRiderByRiderId(riderid);
		model.addAttribute("riders",riders);
				
		return "rider";
	}	
}